package com.rran.study.designpattern.behavioral.strategy.factory;

import com.rran.study.designpattern.behavioral.strategy.strategy.AliPayStrategy;
import com.rran.study.designpattern.behavioral.strategy.strategy.PayStrategy;
import com.rran.study.designpattern.behavioral.strategy.strategy.UnionPayStrategy;
import com.rran.study.designpattern.behavioral.strategy.strategy.WeChatPayStrategy;

/**
 * @author yy
 * @Type PayStrategySimpleFactory.java
 * @Desc 简单工厂(当新增策略时, 会修改工厂的代码, 不推荐)
 * @date 2020/7/20 12:03
 */
public class PayStrategySimpleFactory {
    public static PayStrategy getPayStrategy(String name) {
        switch (name) {
            case "WECHAT":
                return new WeChatPayStrategy();
            case "ALI":
                return new AliPayStrategy();
            case "UNION":
                return new UnionPayStrategy();
            default:
                return null;
        }
    }
}
